﻿using DAL;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;

namespace Test
{
    public static class GenerateSchemaHelper
    {
        public static void GenerateSchema()
        {
            Fluently.Configure()
                .Database(MsSqlConfiguration.MsSql2008
                              .ConnectionString(m => m.Server(@"DANIJEL-PC")
                                  //.ConnectionString(m => m.Server(@"127.0.0.1")
                                  //.ConnectionString(m => m.Server(@"mssql.cloud.hr")
                                                         .Database("BundekDB")
                                                         //.Database("zelenjav_BundekDB")
                                                         .TrustedConnection()
                                                         //.Username("zelenjav_zelenjava").Password("zelenjava")
                                                         ))
                .Mappings(m => m.FluentMappings.AddFromAssemblyOf<NHibernateHelper>())
                          
                .ExposeConfiguration((Configuration config) => new SchemaExport(config).Create(false, true))
                .BuildSessionFactory();
        }
    }
}
